﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	mc:Ignorable="d"
	xmlns:myTwitter_Model="clr-namespace:myTwitter.Model"
	xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
	x:Class="myTwitter.LoggedInUserInfo"
	x:Name="UserControl" Width="298" Height="100" FontFamily="Calibri" FontSize="18">
	<UserControl.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="../SharedResources.xaml"/>
      </ResourceDictionary.MergedDictionaries>

      <myTwitter_Model:Singletons x:Key="SingletonsDataSource" d:IsDataSource="True"/>
  
    	<Style x:Key="ConnectedUserAvatarStyle" TargetType="{x:Type Button}">
    		<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
    		<Setter Property="Background" Value="{StaticResource ButtonNormalBackground}"/>
    		<Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}"/>
    		<Setter Property="BorderThickness" Value="1"/>
    		<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
    		<Setter Property="HorizontalContentAlignment" Value="Center"/>
    		<Setter Property="VerticalContentAlignment" Value="Center"/>
    		<Setter Property="Padding" Value="1"/>
    		<Setter Property="Template">
    			<Setter.Value>
    				<ControlTemplate TargetType="{x:Type Button}">
    					<Border x:Name="_root" HorizontalAlignment="Center" VerticalAlignment="Top" Width="Auto" Height="Auto" BorderThickness="1,1,1,1" Margin="0,0,0,0" CornerRadius="5,5,5,5" BorderBrush="#FF07151F" Background="#FF07151F">
    						<Border.Effect>
    							<DropShadowEffect BlurRadius="5" Color="#FF000000" Opacity="0.395" ShadowDepth="2"/>
    						</Border.Effect>
    						<Border BorderBrush="#FF07151F" BorderThickness="2,2,2,2" CornerRadius="3,3,3,3">
    							<Border Width="Auto" Height="Auto" BorderBrush="{x:Null}" BorderThickness="0.5,0.5,0.5,0.5" CornerRadius="3,3,3,3" Background="#FFFFFFFF">
    								<Grid Width="Auto" Height="Auto">
    									<Path x:Name="_clipZone" Fill="#FFFF0000" Stretch="Fill" Stroke="{x:Null}" Opacity="0" Visibility="Visible" Data="M0,4 C0,1.790861 1.790861,0 4,0 L48,0 C50.209139,0 52,1.790861 52,4 L52,48 C52,50.209139 50.209139,52 48,52 L4,52 C1.790861,52 0,50.209139 0,48 z" Margin="1,1,1,1"/>
    									<Rectangle Fill="#FFFFFFFF" Stroke="{x:Null}" RadiusX="4" RadiusY="4" Visibility="Collapsed"/>
    									<ContentPresenter Width="Auto" Height="Auto" Margin="1,1,1,1" Clip="{Binding Path=Data, ElementName=_clipZone, Mode=Default}"/>
    									<Ellipse Stroke="{x:Null}" Width="62" Height="38" HorizontalAlignment="Center" Margin="0,-16,0,0" VerticalAlignment="Top" Visibility="Collapsed">
    										<Ellipse.Fill>
    											<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
    												<GradientStop Color="#CCFFFFFF" Offset="0.25"/>
    												<GradientStop Color="#31FFFFFF" Offset="1"/>
    											</LinearGradientBrush>
    										</Ellipse.Fill>
    									</Ellipse>
    								</Grid>
    							</Border>
    						</Border>
    					</Border>
    					<ControlTemplate.Triggers>
							
    						<Trigger Property="IsEnabled" Value="false">
    							<Setter Property="Foreground" Value="#ADADAD"/>
    						</Trigger>
    					</ControlTemplate.Triggers>
    				</ControlTemplate>
    			</Setter.Value>
    		</Setter>
    	</Style>
  
    	<Style x:Key="ComboBoxFocusVisual">
    		<Setter Property="Control.Template">
    			<Setter.Value>
    				<ControlTemplate>
    					<Rectangle Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1" Margin="4,4,21,4" SnapsToDevicePixels="true"/>
    				</ControlTemplate>
    			</Setter.Value>
    		</Setter>
    	</Style>
    	<Geometry x:Key="DownArrowGeometry">M 0 0 L 3.5 4 L 7 0 Z</Geometry>
    	<Style x:Key="ComboBoxReadonlyToggleButton" TargetType="{x:Type ToggleButton}">
    		<Setter Property="OverridesDefaultStyle" Value="true"/>
    		<Setter Property="IsTabStop" Value="false"/>
    		<Setter Property="Focusable" Value="false"/>
    		<Setter Property="ClickMode" Value="Press"/>
    		<Setter Property="Template">
    			<Setter.Value>
    				<ControlTemplate TargetType="{x:Type ToggleButton}">
    					<Border HorizontalAlignment="Stretch" Margin="0,0,0,0" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,1,1,1">
    						<Grid HorizontalAlignment="Stretch" Width="Auto">
    							<Grid Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" HorizontalAlignment="Right">
    								<Path x:Name="Arrow" Fill="#FFFFFFFF" HorizontalAlignment="Center" Margin="3,1,0,0" VerticalAlignment="Center" Data="{StaticResource DownArrowGeometry}"/>
    							</Grid>
    							<Path Fill="{TemplateBinding Foreground}" Stretch="Fill" Stroke="#FF103349" HorizontalAlignment="Right" Margin="0,0,14,0" Width="1" Height="16" Data="M38.41,0 L38.41,6.65"/>
    						</Grid>
    					</Border>
    					<ControlTemplate.Triggers>
    						<Trigger Property="IsChecked" Value="true"/>
    						<Trigger Property="IsEnabled" Value="false">
    							<Setter Property="Fill" TargetName="Arrow" Value="#AFAFAF"/>
    						</Trigger>
    					</ControlTemplate.Triggers>
    				</ControlTemplate>
    			</Setter.Value>
    		</Setter>
    	</Style>
    	<LinearGradientBrush x:Key="TextBoxBorder" EndPoint="0,20" StartPoint="0,0" MappingMode="Absolute">
    		<GradientStop Color="#ABADB3" Offset="0.05"/>
    		<GradientStop Color="#E2E3EA" Offset="0.07"/>
    		<GradientStop Color="#E3E9EF" Offset="1"/>
    	</LinearGradientBrush>
    	<Style x:Key="ComboBoxEditableTextBox" TargetType="{x:Type TextBox}">
    		<Setter Property="OverridesDefaultStyle" Value="true"/>
    		<Setter Property="AllowDrop" Value="true"/>
    		<Setter Property="MinWidth" Value="0"/>
    		<Setter Property="MinHeight" Value="0"/>
    		<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
    		<Setter Property="Template">
    			<Setter.Value>
    				<ControlTemplate TargetType="{x:Type TextBox}">
    					<ScrollViewer x:Name="PART_ContentHost" Background="Transparent" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
    				</ControlTemplate>
    			</Setter.Value>
    		</Setter>
    	</Style>
    	<Style x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
    		<Setter Property="OverridesDefaultStyle" Value="true"/>
    		<Setter Property="IsTabStop" Value="false"/>
    		<Setter Property="Focusable" Value="false"/>
    		<Setter Property="ClickMode" Value="Press"/>
    		<Setter Property="Template">
    			<Setter.Value>
    				<ControlTemplate TargetType="{x:Type ToggleButton}">
    					<Microsoft_Windows_Themes:ButtonChrome x:Name="Chrome" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" RenderMouseOver="{TemplateBinding IsMouseOver}" RenderPressed="{TemplateBinding IsPressed}" RoundCorners="false">
    						<Path x:Name="Arrow" Fill="Black" HorizontalAlignment="Center" Margin="0,1,0,0" VerticalAlignment="Center" Data="{StaticResource DownArrowGeometry}"/>
    					</Microsoft_Windows_Themes:ButtonChrome>
    					<ControlTemplate.Triggers>
    						<Trigger Property="IsChecked" Value="true">
    							<Setter Property="RenderPressed" TargetName="Chrome" Value="true"/>
    						</Trigger>
    						<Trigger Property="IsEnabled" Value="false">
    							<Setter Property="Fill" TargetName="Arrow" Value="#AFAFAF"/>
    						</Trigger>
    					</ControlTemplate.Triggers>
    				</ControlTemplate>
    			</Setter.Value>
    		</Setter>
    	</Style>
    	<ControlTemplate x:Key="ComboBoxEditableTemplate" TargetType="{x:Type ComboBox}">
    		<Grid x:Name="Placement" SnapsToDevicePixels="true">
    			<Grid.ColumnDefinitions>
    				<ColumnDefinition Width="*"/>
    				<ColumnDefinition Width="Auto"/>
    			</Grid.ColumnDefinitions>
    			<Popup x:Name="PART_Popup" AllowsTransparency="true" IsOpen="{Binding Path=IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Grid.ColumnSpan="2">
    				<Microsoft_Windows_Themes:SystemDropShadowChrome x:Name="Shdw" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{Binding Path=ActualWidth, ElementName=Placement}" Color="Transparent">
    					<Border x:Name="DropDownBorder" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1">
    						<ScrollViewer>
    							<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.DirectionalNavigation="Contained"/>
    						</ScrollViewer>
    					</Border>
    				</Microsoft_Windows_Themes:SystemDropShadowChrome>
    			</Popup>
    			<Microsoft_Windows_Themes:ListBoxChrome x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" RenderFocused="{TemplateBinding IsKeyboardFocusWithin}" RenderMouseOver="{TemplateBinding IsMouseOver}" Grid.ColumnSpan="2"/>
    			<TextBox x:Name="PART_EditableTextBox" Margin="{TemplateBinding Padding}" Style="{StaticResource ComboBoxEditableTextBox}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" IsReadOnly="{Binding Path=IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}"/>
    			<ToggleButton Style="{StaticResource ComboBoxToggleButton}" Grid.Column="1" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/>
    		</Grid>
    		<ControlTemplate.Triggers>
    			<Trigger Property="IsKeyboardFocusWithin" Value="true">
    				<Setter Property="Foreground" Value="Black"/>
    			</Trigger>
    			<Trigger Property="IsDropDownOpen" Value="true">
    				<Setter Property="RenderFocused" TargetName="Border" Value="true"/>
    			</Trigger>
    			<Trigger Property="HasItems" Value="false">
    				<Setter Property="Height" TargetName="DropDownBorder" Value="95"/>
    			</Trigger>
    			<Trigger Property="IsEnabled" Value="false">
    				<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
    				<Setter Property="Background" Value="#FFF4F4F4"/>
    			</Trigger>
    			<Trigger Property="IsGrouping" Value="true">
    				<Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
    			</Trigger>
    			<Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
    				<Setter Property="Margin" TargetName="Shdw" Value="0,0,5,5"/>
    				<Setter Property="Color" TargetName="Shdw" Value="#71000000"/>
    			</Trigger>
    		</ControlTemplate.Triggers>
    	</ControlTemplate>
    	<Style x:Key="ComboBoxStyle1" TargetType="{x:Type ComboBox}">
    		<Setter Property="FocusVisualStyle" Value="{StaticResource ComboBoxFocusVisual}"/>
    		<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
    		<Setter Property="Background" Value="{StaticResource ButtonNormalBackground}"/>
    		<Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}"/>
    		<Setter Property="BorderThickness" Value="1"/>
    		<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
    		<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
    		<Setter Property="Padding" Value="4,3"/>
    		<Setter Property="Template">
    			<Setter.Value>
    				<ControlTemplate TargetType="{x:Type ComboBox}">
    					<Grid x:Name="MainGrid" SnapsToDevicePixels="true">
    						<Grid.ColumnDefinitions>
    							<ColumnDefinition Width="*"/>
    							<ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="0"/>
    						</Grid.ColumnDefinitions>
    						<Popup x:Name="PART_Popup" Margin="1" AllowsTransparency="true" IsOpen="{Binding Path=IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Grid.ColumnSpan="2">
    							<Microsoft_Windows_Themes:SystemDropShadowChrome x:Name="Shdw" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{Binding Path=ActualWidth, ElementName=MainGrid}" Color="Transparent">
    								<Border x:Name="DropDownBorder" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1">
    									<ScrollViewer CanContentScroll="true">
    										<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.DirectionalNavigation="Contained"/>
    									</ScrollViewer>
    								</Border>
    							</Microsoft_Windows_Themes:SystemDropShadowChrome>
    						</Popup>
    						<ToggleButton Style="{StaticResource ComboBoxReadonlyToggleButton}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" Grid.ColumnSpan="2" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/>
    						<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" IsHitTestVisible="false" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Content="{TemplateBinding SelectionBoxItem}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"/>
    					</Grid>
    					<ControlTemplate.Triggers>
    						<Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
    							<Setter Property="Margin" TargetName="Shdw" Value="0,0,5,5"/>
    							<Setter Property="Color" TargetName="Shdw" Value="#71000000"/>
    						</Trigger>
    						<Trigger Property="HasItems" Value="false">
    							<Setter Property="Height" TargetName="DropDownBorder" Value="95"/>
    						</Trigger>
    						<Trigger Property="IsEnabled" Value="false">
    							<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
    							<Setter Property="Background" Value="#FFF4F4F4"/>
    						</Trigger>
    						<Trigger Property="IsGrouping" Value="true">
    							<Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
    						</Trigger>
    					</ControlTemplate.Triggers>
    				</ControlTemplate>
    			</Setter.Value>
    		</Setter>
    		<Style.Triggers>
    			<Trigger Property="IsEditable" Value="true">
    				<Setter Property="BorderBrush" Value="{StaticResource TextBoxBorder}"/>
    				<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
    				<Setter Property="IsTabStop" Value="false"/>
    				<Setter Property="Padding" Value="3"/>
    				<Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}"/>
    			</Trigger>
    		</Style.Triggers>
    	</Style>
    </ResourceDictionary>
	</UserControl.Resources>
	<UserControl.DataContext>
		<Binding Path="Twitter.ConnectedUserInfo" Mode="Default" Source="{StaticResource SingletonsDataSource}"/>
	</UserControl.DataContext>

	<Grid x:Name="LayoutRoot" Width="Auto">
		<Border HorizontalAlignment="Stretch" Width="Auto" BorderBrush="#FF07151F" BorderThickness="0,0.5,0,0.5" Grid.ColumnSpan="2" Margin="0,15,0,0" Height="40" VerticalAlignment="Top">
			<Border.Background>
				<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
					<GradientStop Color="#FF0F3045" Offset="0"/>
					<GradientStop Color="#FF0D2C3F" Offset="1"/>
					<GradientStop Color="#FE164665" Offset="0.054"/>
				</LinearGradientBrush>
			</Border.Background>
		</Border>
		<Button x:Name="_userPhotoBt" HorizontalAlignment="Left" VerticalAlignment="Top" Style="{DynamicResource ConnectedUserAvatarStyle}" Margin="10,28,0,0" Width="60" Height="60" Click="_userPhotoBt_Click" Cursor="Hand">
			<Image Source="{Binding Path=ProfileImageUrl, Mode=Default}" Stretch="UniformToFill"/>
		</Button>
		<Label HorizontalAlignment="Left" Content="{Binding Path=Name, Mode=Default}" d:LayoutOverrides="Height" Margin="74,-28,0,0" Foreground="#FFD8DDE0" VerticalAlignment="Center" FontSize="18" FontWeight="Bold"/>
		<Grid Margin="0,47,10,10" HorizontalAlignment="Right" Width="54">
			<Image HorizontalAlignment="Center" VerticalAlignment="Bottom" Width="31" Height="26.571" Source="..\Images\followers.png" Margin="0,0,11,0"/>
			<Border Margin="0,10,0,0" VerticalAlignment="Top" BorderBrush="{x:Null}" BorderThickness="1.5,1.5,1.5,1.5" CornerRadius="7,7,7,7" Padding="0,0,0,0" ToolTip="Number of followers" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Right">
				<Border.RenderTransform>
					<TransformGroup>
						<ScaleTransform ScaleX="1" ScaleY="1"/>
						<SkewTransform AngleX="0" AngleY="0"/>
						<RotateTransform Angle="0"/>
						<TranslateTransform X="0" Y="0"/>
					</TransformGroup>
				</Border.RenderTransform>
				<Border.Background>
					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
						<GradientStop Color="#FFDA2F2F" Offset="0"/>
						<GradientStop Color="#FF721919" Offset="1"/>
					</LinearGradientBrush>
				</Border.Background>
				<Grid Height="Auto">
					<Grid.RowDefinitions>
						<RowDefinition Height="10.65*"/>
						<RowDefinition Height="10*"/>
					</Grid.RowDefinitions>
					<TextBlock x:Name="_nbOfFolllowers" HorizontalAlignment="Center" VerticalAlignment="Center" Width="Auto" Height="Auto" Grid.RowSpan="2" FontFamily="Calibri" FontSize="11" Foreground="#FFFFFFFF" Padding="3,0,3,0" TextWrapping="Wrap" Margin="2,0,2,0" Text="{Binding Path=FollowersCount, Mode=Default}"/>
					<Border BorderBrush="{x:Null}" CornerRadius="7,7,7,7" Margin="0,0,0,-3.187">
						<Border.Background>
							<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
								<GradientStop Color="#92FFFFFF" Offset="0"/>
								<GradientStop Color="#00FFFFFF" Offset="0.747"/>
							</LinearGradientBrush>
						</Border.Background>
					</Border>
				</Grid>
			</Border>
		</Grid>
		<ComboBox x:Name="_actions" HorizontalAlignment="Right" Margin="0,26,8,0" Style="{DynamicResource ComboBoxStyle1}" VerticalAlignment="Top" IsSynchronizedWithCurrentItem="True" SelectedIndex="0" Foreground="#FFDEDEDE" BorderThickness="0,0,0,0" BorderBrush="#FF081721" FontSize="12" Padding="10,1,10,3" SelectionChanged="_actions_SelectionChanged">
			<ComboBox.Background>
				<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
					<GradientStop Color="#FF0F2C41" Offset="0"/>
					<GradientStop Color="#FF07151F" Offset="1"/>
				</LinearGradientBrush>
			</ComboBox.Background>
			<ComboBoxItem x:Name="_online" Content="online"/>
			<ComboBoxItem x:Name="_signOut" Content="sign out"/>
		</ComboBox>
	</Grid>
</UserControl>